﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Domaine.Entity
{
    public class User
    {
        #region Members

        string _UserName;

        #endregion


        #region Ctor

        public User() { UserID = Guid.NewGuid(); }

        #endregion


        #region Properties



        [Key]
        public Guid UserID { get; set; }

        [Required]
        public Guid ApplicationID { get; set; }

        public AspApplication Application { get; set; }


        [Required]
        [MaxLength(256)]
        public string UserName
        {
            get { return _UserName; }
            set { _UserName = value; LoweredUserName = value.ToLower(); }
        }

        [Required]
        [MaxLength(256)]
        public string LoweredUserName { get; set; }

        [MaxLength(16)]
        public string MobileAlias { get; set; }

        [Required]
        public bool IsAnonymous { get; set; }

        [Required]
        public DateTime LastActivityDate { get; set; }

        [Required]
        public Membership Membership { get; set; }

        public virtual ICollection<Role> Roles { get; set; }
        #endregion
    }
}
